// 引入Layout组件
import Layout from '@/layout'
// 常量路由:任何用户都可以访问的地址,并且可以展示当前这个地址对应的界面
export const constantRoutes = [
  // 注册登录的路由
  {
    path: '/login',
    component: () => import('@/views/login/index'),
    hidden: true
  },
  // 注册404的路由
  {
    path: '/404',
    component: () => import('@/views/404'),
    hidden: true
  },
  // 注册的是首页的路由
  {
    path: '/',
    component: Layout,
    redirect: '/dashboard',
    children: [{
      path: 'dashboard',
      name: 'Dashboard',
      component: () => import('@/views/dashboard/index'),
      meta: { title: '首 页', icon: 'dashboard' }
    }]
  }
]

// 动态路由(异步路由)
export const asyncRoutes = [
  // 权限相关的路由

  /* 权限管理 */
  {
    name: 'Acl',
    path: '/acl',
    component: Layout,
    redirect: '/acl/user/list',
    meta: {
      title: '权限管理',
      icon: 'el-icon-lock'
    },
    children: [
      {
        name: 'User',
        path: 'user/list',
        component: () => import('@/views/acl/user/list'),
        meta: {
          title: '用户管理',
        },
      },
      {
        name: 'Role',
        path: 'role/list',
        component: () => import('@/views/acl/role/list'),
        meta: {
          title: '角色管理',
        },
      },
      {
        name: 'RoleAuth',
        path: 'role/auth/:id',
        component: () => import('@/views/acl/role/roleAuth'),
        meta: {
          activeMenu: '/acl/role/list',
          title: '角色授权',
        },
        hidden: true,
      },
      {
        name: 'Permission',
        path: 'permission/list',
        component: () => import('@/views/acl/permission/list'),
        meta: {
          title: '菜单管理',
        },
      },
    ]
  },
  // 需要配置权限相关的路由(权限相关的地址对应着权限相关的组件文件---权限路由)
  // 注册商品管理模块的路由,有些用户的权限比较低,就不让他看到这个地址及对应的组件内容
  // 商品管理模块的路由对象(地址-组件),这样的路由叫动态的路由(异步路由)(有些人可以看,有些人不能看)
  {
    name: 'Product',
    path: '/product',
    component: Layout,
    redirect: '/product/category/list',
    meta: { title: '商品管理', icon: 'el-icon-s-shop' },
    children: [
      // 注册分类管理路由
      {
        name: 'Category',
        path: 'category/list',
        component: () => import('@/views/product/category'),
        meta: { title: '分类管理' }
      },
      // 注册品牌管理路由
      {
        name: 'Trademark',
        path: 'trademark/list',
        component: () => import('@/views/product/trademark'),
        meta: { title: '品牌管理' }
      },
      // 注册平台属性管理路由
      {
        name: 'Attr',
        path: 'attr/list',
        component: () => import('@/views/product/attr'),
        meta: { title: '平台属性管理' }
      },
      // 注册SPU管理路由
      {
        name: 'Spu',
        path: 'spu/list',
        component: () => import('@/views/product/spu'),
        meta: { title: 'SPU管理' }
      },
      // 注册SKU管理路由
      {
        name: 'Sku',
        path: 'sku/list',
        component: () => import('@/views/product/sku'),
        meta: { title: 'SKU管理' }
      }
    ]
  }

]
// 任意路由
export const anyRoutes = { path: '*', redirect: '/404', hidden: true }


